package com.taoyuan.container.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.taoyuan.common.utils.StringUtils;
import com.taoyuan.container.mapper.GpuMapper;
import com.taoyuan.container.domain.Gpu;
import com.taoyuan.container.service.IGpuService;

/**
 * GUP信息Service业务层处理
 *
 * @author taoyuan
 * @date 2023-07-02
 */
@Service
public class GpuServiceImpl extends ServiceImpl<GpuMapper, Gpu> implements IGpuService {
    @Autowired
    private GpuMapper gpuMapper;

    /**
     * 查询GUP信息列表
     *
     * @param gpu GUP信息
     * @return GUP信息
     */
    @Override
    public List<Gpu> selectGpuList(Gpu gpu) {
    	LambdaQueryWrapper<Gpu> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotEmpty(gpu.getContainerIp())) {
			queryWrapper.eq(Gpu::getContainerIp, gpu.getContainerIp());
		}
        if (StringUtils.isNotEmpty(gpu.getContainerName())) {
			queryWrapper.like(Gpu::getContainerName, gpu.getContainerName());
		}
        if (StringUtils.isNotEmpty(gpu.getGpuP1())) {
			queryWrapper.eq(Gpu::getGpuP1, gpu.getGpuP1());
		}
        if (StringUtils.isNotEmpty(gpu.getGpuP2())) {
			queryWrapper.eq(Gpu::getGpuP2, gpu.getGpuP2());
		}
        if (StringUtils.isNotEmpty(gpu.getGpuP3())) {
			queryWrapper.eq(Gpu::getGpuP3, gpu.getGpuP3());
		}
        if (StringUtils.isNotEmpty(gpu.getGpuP4())) {
			queryWrapper.eq(Gpu::getGpuP4, gpu.getGpuP4());
		}
        if (StringUtils.isNotEmpty(gpu.getGpuP5())) {
			queryWrapper.eq(Gpu::getGpuP5, gpu.getGpuP5());
		}
        if (StringUtils.isNotEmpty(gpu.getGpuP6())) {
			queryWrapper.eq(Gpu::getGpuP6, gpu.getGpuP6());
		}
        return gpuMapper.selectList(queryWrapper);
    }
}
